home *** CD-ROM | disk | FTP | other *** search
/ SGI Developer Toolbox 6.1 / SGI Developer Toolbox 6.1 - Disc 4.iso / public / bit / src / global.h < prev    next >
C/C++ Source or Header  |  1994-08-01  |  12KB  |  542 lines

  1. /*
  2.  * $Id: global.h,v 0.91 1994/02/20 00:53:34 zhao Pre-Release $
  3.  *
  4.  *. This file is part of BIT shareware package. After the two weeks of
  5.  *  free evaluation period, you are encouraged (required) to register
  6.  *  your copy for a small registration fee, which is $35 for personal use
  7.  *  and $50 for commercial, government and institutional use.
  8.  *
  9.  *  Copyright(c) 1993, 1994 by T.C. Zhao.
  10.  *  All rights reserved.
  11.  *
  12.  *  Permission to use, copy, and distribute this software in its entirety
  13.  *  for non-commercial purposes is hereby granted, provided that the
  14.  *  above shareware and copyright notices and this permission notice
  15.  *  appear in all copies and their documentation.
  16.  *
  17.  *  This software may be modified for your own use, but modified versions
  18.  *  may not be distributed without prior consent of the author.
  19.  *
  20.  *  This software is provided "as is" without expressed or implied
  21.  *  warranty of any kind.
  22.  *
  23.  *.
  24.  *
  25.  * Global varaibles
  26.  */
  27.  
  28. #ifndef BIT_GLOBAL_H
  29. #define BIT_GLOBAL_H
  30.  
  31. /*******************************************************************
  32.  * img_io specifies how to identify an image format by signature or
  33.  * filename extension. other fields specifies how to read or write the
  34.  * image format in question.
  35.  *
  36.  * Special Note: if the order is changed, remember to change the order
  37.  * in tc.c too. Images only identifiable by the extension should appear
  38.  * after all images that have a signature.
  39.  *
  40.  * Raster direction specifies the direction the load routines handed
  41.  * over to the driver routine, NOT the direction specified in the
  42.  * format itself.
  43.  *******************************************************************/
  44.  
  45. /* some compilers bitch about the signedness of the signature */
  46.  
  47. #define UC_ (unsigned char *)
  48.  
  49. /* some short cuts */
  50. #define Null_next         0
  51. #define Null_load         0
  52. #define Null_dump         0
  53. #define Null_get_option   0
  54. #define Null_set_option   0
  55. #define Null_special      0
  56. #define No_text           0
  57. #define Yes_text          1
  58. #define Built_in_display  0
  59. #define Top_to_bottom     1
  60. #define Bottom_to_top     0
  61.  
  62. IMG_IO img_io[] =
  63. {
  64.  /* IRIS RGB format. Always built */
  65.  
  66.     {T_RGBA,            /* type                            */
  67.      0,                /* no. of colors. does not apply   */
  68.      {
  69.      {2, UC_ "\001\332"},    /* signatures                      */
  70.      {2, UC_ "\332\001"},    /* signatures with byte swapped    */
  71.      },
  72.      "IRIS RGB Format",        /* Formal name                     */
  73.      "IRIS",            /* short name                      */
  74.      "rgb",            /* extension name                  */
  75.      RGB_desc,            /* get image size, pixel size info */
  76.      RGB_load,            /* load raster                     */
  77.      RGB_dump,            /* routine to write the image      */
  78.      Null_next,            /* load next one                   */
  79.      Null_get_option,        /* get write parameters            */
  80.      Null_set_option,        /* function to call before write   */
  81.      Built_in_display,        /* display function                */
  82.      Null_special,        /* special for this format         */
  83.      Bottom_to_top,        /* raster directions               */
  84.      No_text            /* if do text&sgf info by driver   */
  85.     }
  86.  
  87. #ifndef  NO_PNM
  88.  
  89.  /**** PNM includes PPM, PGM and PBM ***/
  90.     ,
  91.     {T_RGBA,            /* ppm */
  92.      0,
  93.      {
  94.      {2, UC_ "P6"},
  95.      {2, UC_ "P3"}
  96.      },
  97.      "PPM Format", "PPM", "ppm",
  98.      PNM_desc,
  99.      PPM_load,
  100.      PPM_dump,
  101.      Null_next,
  102.      PPM_wdefault,
  103.      PPMdump_init,
  104.      Built_in_display,
  105.      Null_special,
  106.      Bottom_to_top,
  107.      Yes_text            /* capable of text */
  108.     }
  109.     ,
  110.  
  111.     {T_GRAY,            /* pgm */
  112.      0,
  113.      {
  114.      {2, UC_ "P5"},
  115.      {2, UC_ "P2"}
  116.      },
  117.      "PGM Format",
  118.      "PGM", "pgm",
  119.      PNM_desc,
  120.      PPM_load,
  121.      PPM_dump,
  122.      Null_next,
  123.      PPM_wdefault,
  124.      PPMdump_init,
  125.      Built_in_display,
  126.      Null_special,
  127.      Bottom_to_top,
  128.      Yes_text
  129.     }
  130.  
  131.     ,
  132.     {T_BW,            /* pbm */
  133.      2,
  134.      {
  135.      {2, UC_ "P4",},
  136.      {2, UC_ "P1"}
  137.      },
  138.      "PBM format", "PBM", "pbm",
  139.      PNM_desc,
  140.      PBM_load,
  141.      PBM_dump,
  142.      Null_next,
  143.      PPM_wdefault,
  144.      PPMdump_init,
  145.      Built_in_display,
  146.      bw_special,
  147.      Bottom_to_top,
  148.      Yes_text
  149.     }
  150.  
  151. #endif
  152.  
  153.  
  154. #ifndef NO_GIF
  155.  /******* CompuServ GIF *******/
  156.     ,
  157.     {T_CMAP,
  158.      256,
  159.      {
  160.      {6, UC_ "GIF87a"},
  161.      {6, UC_ "GIF89a"}
  162.      },
  163.      "CompuServ GIF", "GIF", "gif",
  164.      GIF_desc,
  165.      GIF_load,
  166.      GIF_dump,
  167.      Null_next,
  168.      GIF_wdefault,
  169.      GIFdump_init,
  170.      Built_in_display,
  171.      Null_special,
  172.      Top_to_bottom,
  173.      No_text
  174.     }
  175. #endif
  176.  
  177.  
  178. #ifndef NO_JPEG
  179.  
  180.  /***** JPEG from independent JPEG group ******/
  181.  
  182.  /* 255, 216, 255, 224, 0, 16, JFIF                */
  183.     ,
  184.     {T_RGBA,
  185.      0,
  186.      {
  187.      {10, UC_ "\377\330\377\340\000\020JFIF"},
  188.      {2, UC_ "\377\330"}
  189.      },
  190.      "JFIF format", "JPEG", "jpg",
  191.      JPEG1_desc,
  192.      JPEG1_load,
  193.      JPEG1_dump,
  194.      Null_next,
  195.      JPEG1_wdefault,
  196.      JPEG1dump_init,
  197.      Built_in_display,
  198.      Null_special,
  199.      Bottom_to_top,
  200.      No_text
  201.     }
  202. #endif
  203.  
  204. #ifndef NO_PS
  205.  
  206.  /********* PostScript ****************/
  207.     ,
  208.     {T_RGBA,
  209.      0,
  210.      {
  211.      {10, UC_ "%!PS-Adobe"}
  212.      },
  213.      "PostScript", "PS", "ps",
  214.      PS_desc,
  215.      PS_load,
  216.      PS_dump,
  217.      PS_next,
  218.      PS_wdefault,
  219.      PSdump_init,
  220.      Built_in_display,
  221.      Null_special,
  222.      Bottom_to_top,
  223.      No_text            /* will be taken care of in dump */
  224.     }
  225. #endif
  226.  
  227. #ifndef NO_XBM
  228.  
  229.  /******* X11 bitmaps **********/
  230.     ,
  231.     {T_BW,
  232.      2,
  233.      {
  234.      {4, UC_ "#def"}
  235.      },
  236.      "X Window Bitmap", "XBM", "xbm",
  237.      XBM_desc,
  238.      XBM_load,
  239.      XBM_dump,
  240.      Null_next,
  241.      Null_get_option,
  242.      Null_set_option,
  243.      Built_in_display,
  244.      bw_special,
  245.      Bottom_to_top,
  246.      No_text
  247.     }
  248. #endif
  249.  
  250. #ifdef ADD_HOLO
  251.  
  252.  /********* Electron Hologram ******************/
  253.     ,
  254.     {T_CMAP,
  255.      256,
  256.      {
  257.      {4, UC_ "DSAA"},
  258.      {4, UC_ "DSBB"}
  259.      },
  260.      "XPS Hologram", "EH", "eh",
  261.      HOLO_desc,
  262.      HOLO_load,
  263.      HOLO_dump,
  264.      Null_next,
  265.      HOLO_wdefault,
  266.      HOLOdump_init,
  267.      Built_in_display,
  268.      HOLO_special,
  269.      Bottom_to_top,
  270.      Yes_text
  271.     }
  272. #endif
  273.  
  274. #ifdef ADD_TC
  275.  
  276.  /******** My own stuff ************/
  277.     ,
  278.     {T_FLEX,
  279.      -1,
  280.      {
  281.      {6, UC_ "TCZ1.0"}
  282.      },
  283.      "UniFormat",
  284.      "UniF",
  285.      "dat",
  286.      TC_desc,
  287.      TC_load,
  288.      Null_dump,
  289.      Null_next,
  290.      Null_set_option,
  291.      Null_get_option,
  292.      Null_special,
  293.      Bottom_to_top,
  294.      No_text
  295.     }
  296. #endif
  297.  
  298. #ifndef NO_MPEG
  299.  
  300.  /******* MPEG ***********/
  301.     ,
  302.     {T_RGBA,
  303.      0,
  304.      {
  305.      {4, UC_ "\000\000\001\263"}
  306.      },
  307.      "MPEG Movies",
  308.      "MPEG",
  309.      "mpg",
  310.      MPEG_desc,
  311.      MPEG_load,
  312.      Null_dump,
  313.      MPEG_next,
  314.      Null_get_option,
  315.      Null_set_option,
  316.      Built_in_display,
  317.      Null_special,
  318.      Bottom_to_top,
  319.      No_text
  320.     }
  321. #endif /* MPEG */
  322.  
  323.  
  324. /********* Scratch files. Always defined *********/
  325.     ,
  326.     {T_FLEX,
  327.      -1,
  328.      {
  329.      {6, UC_ "BIT1.0"}
  330.      },
  331.      "Scratch File", "TMP", "tmp",
  332.      TMP_desc,
  333.      TMP_load,
  334.      TMP_dump,
  335.      Null_next,
  336.      TMP_wdefault,
  337.      TMPdump_init,
  338.      Built_in_display,
  339.      Null_special,
  340.      Bottom_to_top,
  341.      Yes_text
  342.     }
  343.  
  344. #ifndef NO_SUNRAS
  345.  
  346.  /****** Sun rasterfile *************/
  347.     ,
  348.     {T_FLEX,
  349.      -1,
  350.      {
  351.      {4, UC_ "\131\246\152\225"}
  352.      },
  353.      "Sun Rasterfile", "RAS", "ras",
  354.      RAS_desc,
  355.      RAS_load,
  356.      RAS_dump,
  357.      Null_next,
  358.      Null_get_option,
  359.      Null_set_option,
  360.      Built_in_display,
  361.      Null_special,
  362.      Bottom_to_top,
  363.      Yes_text
  364.     }
  365. #endif
  366.  
  367. #ifndef NO_COMPRESS
  368.  
  369.  /***** compressed file hack *************/
  370.     ,
  371.     {T_FLEX,
  372.      -1,
  373.      {
  374.      {2, UC_ "\037\235"}
  375.      },
  376.      "Compressed ", "CMPRS", "Z",
  377.      Compress_desc,
  378.      Compress_load,
  379.      Null_dump,
  380.      Null_next,
  381.      Null_get_option,
  382.      Null_set_option,
  383.      Built_in_display,
  384.      Null_special,
  385.      0,
  386.      No_text
  387.     }
  388. #endif
  389.  
  390. #ifndef NO_TIFF
  391.  
  392.  /******** TIFF files. **************/
  393.     ,
  394.     {T_FLEX,
  395.      -1,
  396.      {
  397.      {2, UC_ "MM"},
  398.      {2, UC_ "II"}
  399.      },
  400.      "TIFF File", "TIFF", "tif",
  401.      TIFF_desc,
  402.      TIFF_load,
  403.      TIFF_dump,
  404.      Null_next,
  405.      TIFF_wdefault,
  406.      TIFF_dumpinit,
  407.      0,
  408.      0,
  409.      0,
  410.      No_text
  411.     }
  412. #endif
  413.  
  414. #ifdef DEVELOP_BIT
  415.     ,
  416.     {T_BW,
  417.      2,
  418.      {
  419.      {6, UC_ "MMMMMM"},
  420.      {6, UC_ "IIIIII"}
  421.      },
  422.      "GL Patterns", "Pat", "pat",
  423.      PAT_desc,
  424.      Null_load,
  425.      PAT_dump,
  426.      Null_next,
  427.      0,
  428.      0,
  429.      0,
  430.      0,
  431.      0,
  432.      No_text
  433.     }
  434. #endif
  435.  
  436. #ifdef DEVELOP_BIT
  437.     ,
  438.     {T_BW,
  439.      2,
  440.      {
  441.      {6, UC_ "cccccc"},
  442.      {6, UC_ "hhhhhh"}
  443.      },
  444.      "GL Cursor", "Cur", "cur",
  445.      CUR_desc,
  446.      Null_load,
  447.      CUR_dump,
  448.      Null_next,
  449.      0,
  450.      0,
  451.      0,
  452.      0,
  453.      0,
  454.      No_text
  455.     }
  456. #endif
  457.  
  458. };
  459.  
  460. int totalfmt = sizeof(img_io) / sizeof(img_io[0]);
  461.  
  462. /****** All formats that are capable of writing ************/
  463.  
  464. int totalwrite;
  465. IMG_IO *wio[30];
  466.  
  467. /***********************************************************/
  468.  
  469. IPTR imgptr;
  470. rgba_t background_color = 0x008f8f8f;
  471.  
  472. /* screen size in pixels ****/
  473. int screen_xp, screen_yp;
  474.  
  475. /********************************************************
  476.  * main windows id's and dimensions
  477.  ********************************************************/
  478.  
  479. long win_id = -1;
  480. long win_w, win_h;
  481. long win_xo, win_yo;
  482.  
  483. /***********************************************************
  484.  * Various flags that control the subtle things in the program
  485.  *************************************************************/
  486. #include "date.h"
  487. int double_buf;            /* if double buffer.                  */
  488. int keepmisc;            /* keep text and sgf across images    */
  489. int always_clear = 1;        /* refresh screen between each display */
  490. int always_border;        /* force a border on forms            */
  491. int report_mouse;        /* report mouse locations             */
  492. int preserve_wm_colors = 1;    /* keep black & white                 */
  493. int crop_fill = 1;        /* if fill crop region larger than im */
  494. int always_pan = 1;        /* if auto pan: 1 for slidesonly      */
  495. int always_delete;        /* if deletion w/o confirmation       */
  496. int always_readscrn;        /* Cut buffer source                  */
  497. int auto_remove = 1;        /* if remove bad files                */
  498. int auto_ext = 1;        /* if add extension on write          */
  499. int auto_position;        /* if ignore postion file             */
  500. int halftone_method;        /* B&W dithering method               */
  501. int quant_method;        /* qunatization method                */
  502. int display_style;        /* special effects in display         */
  503. int report_level = 3;        /* index into percentage arrays       */
  504. int percent_report;        /* the percentage                     */
  505. int verbose = 1;        /* warning and error only             */
  506. int pezx = 15;            /* pixedit magnification              */
  507. int pezy = 15;            /* pixedit magnification              */
  508. int slideshow;            /* pause between frames               */
  509. int slide_pause_index;        /* index into pause time              */
  510. int showedit;            /* if show editing panel automatically */
  511. int full_win;            /* if startup full window             */
  512. int no_panel;            /* no initial control panels          */
  513. int no_clockmail = 1;        /* no clock&mail window               */
  514. int abort_change_ask;        /* if silently abort changes          */
  515. int show_cut_buffer = 1;    /* draw cut buffers                   */
  516. int monitoring;
  517. float g_zoomx = 1.0, g_zoomy = 1.0;
  518. int simu_dbl_buffer;        /* if simulate double buffering        */
  519. int simu_op_dblbuf;        /* if simulate dblbuf in overlay plane */
  520. int smooth_lines;        /* true if line drawn anti-aliased     */
  521. int auto_remove_thumbnail = 1;    /* true if del thumbnail when orig. gone */
  522. int ps_res_index;
  523. int fit_image_size;
  524. int run_in_background = 1;
  525.  
  526. int form_single;        /* undocumented */
  527.  
  528. const char *hexdigits = "0123456789abcdef";
  529.  
  530. /* compiler won't merge strings, here we save some space */
  531.  
  532. const char *mfailed = "malloc failed";
  533. const char *bugquit = "Internal error";
  534. const char *outbound = "Out of bounds";
  535. const char *sharewh = "@b@c@C1BIT IS SHAREWARE";
  536. const char *dontforget = "@b@c@C1Please don't forget to register";
  537. const char *unreg = "Unregistered copy";
  538. const char *infofmt = "@b@c@C1See %sRegistration for details";
  539.  
  540.  
  541. #endif /* BIT_GLOBAL_H */
  542.